#!/bin/bash
# Copyright 2020 ETH Zurich and University of Bologna.
# Solderpad Hardware License, Version 0.51, see LICENSE for details.
# SPDX-License-Identifier: SHL-0.51

set -e
ROOT=$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)

# Get all Bender.yml and format them. Exclude the vendor directory and hidden
# dirs.
# Unfortunately we also need to exclude the `mkdocs.yml` file because the
# formatter would remove the double exclamation mark. Preventing `mkdocs` from
# loading the modules correctly.
find $ROOT \
    -not \( -path $ROOT/'rtl/vendor' -prune \) \
    -name '*.core' | xargs yamlfmt -w
